package com.frp.protocol;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 数据传输消息
 */
public class DataMessage extends Message {
    @JsonProperty("proxy_name")
    private String proxyName;
    
    @JsonProperty("data")
    private byte[] data;
    
    @JsonIgnore
    private int length;
    
    public DataMessage() {
        super(MessageType.Data);
    }
    
    public DataMessage(String proxyName, byte[] data) {
        super(MessageType.Data);
        this.proxyName = proxyName;
        this.data = data;
        this.length = data != null ? data.length : 0;
    }
    
    public String getProxyName() { return proxyName; }
    public void setProxyName(String proxyName) { this.proxyName = proxyName; }
    
    public byte[] getData() { return data; }
    public void setData(byte[] data) { 
        this.data = data;
        this.length = data != null ? data.length : 0;
    }
    
    public int getLength() { return length; }
    public void setLength(int length) { this.length = length; }
}